package com.coocaa.x.app.liteplayer.ui;


import com.coocaa.x.app.liteplayer.R;

import android.content.Context;
import android.view.Gravity;
import android.view.View;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;


public class PlayerTipView extends LinearLayout {
    private Context mContext;
    private ImageView icon;
    private TextView tipText;
    private int tipTextSize = SkyConstants.Dpi(60);

    public PlayerTipView(Context context) {
        super(context);
        this.mContext = context;
        // TODO Auto-generated constructor stub
        createView();
    }

    private void createView() {
        this.setOrientation(LinearLayout.VERTICAL);
        this.setGravity(Gravity.CENTER);
        this.setBackgroundColor(SkinManager.getColor(R.color.tipCoverColor));

        icon = new ImageView(mContext);
        tipText = new TextView(mContext);
        tipText.setTextSize(tipTextSize);
        tipText.setTextColor(SkinManager.getColor(R.color.playerTitleColor));
        tipText.setSingleLine();
        this.addView(icon, new LayoutParams(LayoutParams.WRAP_CONTENT,
                LayoutParams.WRAP_CONTENT));
        this.addView(tipText, new LayoutParams(LayoutParams.WRAP_CONTENT,
                LayoutParams.WRAP_CONTENT));
    }

    public void hideTip() {
        this.setVisibility(View.INVISIBLE);
    }

    public void showPauseStatus() {
        tipText.setVisibility(View.GONE);
        SkinManager.setBackground(icon, R.drawable.paused_icon);
        this.setVisibility(View.VISIBLE);
    }

    public void showNetStatus() {
        tipText.setText("network seems to be disonnected. Please check it");
        tipText.setVisibility(View.VISIBLE);
        SkinManager.setBackground(icon, R.drawable.net_bug_icon);
        this.setVisibility(View.VISIBLE);
    }
}
